home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1985 December / 1985-12.d64 / dragons den (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  151 lines

  1. 10 poke198,0
  2. 100 y=826:poke53280,0:poke53281,0:print"[147][152]       d r a g o n ' s   d e n"
  3. 110 print"    please wait while maze is drawn"
  4. 120 bo$="                                       ":x$=""
  5. 130 f=831:g=832:h=829:c=3:dimm$(10,11):fori=1to9:forj=1to10
  6. 140 m$(i,j)=str$(int((7*rnd(1))+1))+str$(int((8*rnd(1))+1)):nextj,i
  7. 150 s=i+10:i=int((8*rnd(1))+1):j=int((9*rnd(1))+1):goto520
  8. 160 printx$"[151]";b$:b$="":ify$="m"thenprinttab(18)"[145]"sl
  9. 170 print"[155][145][145] c[146]hart m[146]ark b[146]ack";ss$"":ifhs=1then1320
  10. 180 ifwt>100ors<1then1180
  11. 190 gety$:ify$=""then190
  12. 200 ifde=1andy$<>"b"then190
  13. 210 gosub1580:de=0:print"[145]"sb$,sb$"[145]":gosub1560:ify$="c"then1420
  14. 220 ify$="m"thengosub1530:gosub930:sl=sl+1:s=s-1:b$="bread slices used":goto160
  15. 230 iftc=1thentc=0
  16. 240 wt=wt+1:ify$="l"andld=1ory$="r"andrd=1ory$="a"andfd=1ory$="b"then280
  17. 250 ify$="t"thenprint""spc(20)" [145]"
  18. 260 ify$="t"andtd=1then960
  19. 270 goto160
  20. 280 saf=i:fas=j:td=0:ld=0:rd=0:fd=0:ify$="b"thentc=1
  21. 290 iftb=1then470
  22. 300 iflt=1then370
  23. 310 ifrt=1then420
  24. 320 tb=0:lt=0:rt=0:ify$="l"thenj=j-1:lt=1:c=1
  25. 330 ify$="r"thenj=j+1:rt=1:c=2
  26. 340 ify$="a"theni=i-1:c=3
  27. 350 ify$="b"theni=i+1:tb=1:c=4
  28. 360 goto510
  29. 370 tb=0:lt=0:rt=0:ify$="l"theni=i+1:tb=1:c=4
  30. 380 ify$="r"theni=i-1:c=3
  31. 390 ify$="a"thenj=j-1:lt=1:c=1
  32. 400 ify$="b"thenj=j+1:rt=1:c=2
  33. 410 goto510
  34. 420 tb=0:lt=0:rt=0:ify$="l"theni=i-1:c=3
  35. 430 ify$="r"theni=i+1:tb=1:c=4
  36. 440 ify$="a"thenj=j+1:rt=1:c=2
  37. 450 ify$="b"thenj=j-1:lt=1:c=1
  38. 460 goto510
  39. 470 tb=0:lt=0:rt=0:ify$="l"thenj=j+1:rt=1:c=2
  40. 480 ify$="r"thenj=j-1:lt=1:c=1
  41. 490 ify$="a"theni=i+1:tb=1:c=4
  42. 500 ify$="b"theni=i-1:c=3
  43. 510 ss$="":goto790
  44. 520 print"[147]":forij=1to20:print"[166][166][166][166][166][166][166][166][166][166][166][166][166][166][166]"spc(10)"[166][166][166][166][166][166][166][166][166][166][166][166][166][166]":nextij
  45. 530 print"":forii=1to4:printtab(15)"[178][177][178][177][178][177][178][177][178][177][157][157][157][157][157][157][157][157][157][157][177][178][177][178][177][178][177][178][177][178]":nextii
  46. 540 pz=12:zp=15:forij=1to12:zp=zp-1:forji=1topz
  47. 550 printtab(zp)" ";:nextji:pz=pz+2:print:nextij:print""
  48. 560 jj=8:forii=14to3step-1:jj=jj+2
  49. 570 printtab(ii)"[169]"spc(jj)"[223]":nextii
  50. 580 printleft$(x$,19)tab(16)"    ":printtab(17)"    ":printleft$(x$,19);
  51. 590 ifc=3thenprinttab(17)"[155]n":printtab(17)"^"
  52. 600 ifc=4thenprinttab(17)"v":printtab(17)"[155]n"
  53. 610 ifc=1thenprinttab(16)"[155][195]>n"
  54. 620 ifc=2thenprinttab(16)"n[155]<[195]"
  55. 630 ifi>9orj>10ori<1orj<1thensaf=i:fas=j:goto760
  56. 640 mm=val(left$(m$(i,j),2)):onmmgoto650,660,670,680,690,700,710,760
  57. 650 gosub850
  58. 660 gosub770
  59. 670 gosub880:goto720
  60. 680 gosub850
  61. 690 gosub770:goto720
  62. 700 gosub880
  63. 710 gosub850
  64. 720 ifright$(m$(i,j),2)="22"thengosub930
  65. 730 ifmm>4thengosub940
  66. 740 ifval(mid$(m$(i,j),4,1))<6thengosub1260
  67. 750 goto160
  68. 760 gosub1580:printx$spc(11);"[145]dead end[146] go b[146]ack!":de=1:goto180
  69. 770 printleft$(x$,10):forgi=1to4:printtab(18)"[145][145]    ":next
  70. 780 printtab(18)"[145][145][169]  [223]":fd=1:pq=19:ss$=ss$+" a[146]head":goto920
  71. 790 print"":forii=1to4:printtab(15)"[178][177][178][177][178][177][178][177][178][177][157][157][157][157][157][157][157][157][157][157][177][178][177][178][177][178][177][178][177][178]":nextii
  72. 800 print"":forii=1to8:printtab(15)"          ":nextii
  73. 810 print"":forgi=1to9:printtab(6)"[166][166][166][166]":next:ld=0:printtab(6)"[166][166][166][169]"
  74. 820 printtab(6)"[166][166][169]":printtab(6)"[166][169]":printtab(6)"[169]"
  75. 830 print"":forgi=1to9:printtab(30)"[166][166][166][166]":next:rd=0:printtab(30)"[223][166][166][166]"
  76. 840 printtab(31)"[223][166][166]":printtab(32)"[223][166]":printtab(33)"[223]":goto580
  77. 850 printleft$(x$,19):forgi=1to3:printtab(6)"[145][145]    ":next
  78. 860 forgi=1to8:printtab(6)"[145][145][163][163][163][163]":next:ld=1
  79. 870 ss$=ss$+" l[146]eft":qp=6:pq=7:goto910
  80. 880 printleft$(x$,19):forgi=1to3:printtab(30)"[145][145]    ":next:rd=1
  81. 890 forgi=1to8:printtab(30)"[145][145][163][163][163][163]":next:ld=1
  82. 900 ss$=ss$+" r[146]ight":qp=30:pq=31
  83. 910 printtab(qp)"[145][145][169][163][163][223]"
  84. 920 printtab(pq)"[145][145][169][223]":return
  85. 930 printleft$(x$,16)tab(20)"[155][213][192][201][157][157][157][173][192][189]":return
  86. 940 printleft$(x$,13)tab(17)"[206][163][163][163][163][163][205]":printtab(16)"[206]   [215]   [205]"
  87. 950 printtab(16)"[184][184][184][184][184][184][184][184][184]":td=1:ss$=ss$+" t[146]rap":return
  88. 960 print""tab(16)"[185][185][185][185][185][185][185][185][185]":printtab(16)"[205]       [206]"
  89. 970 printtab(17)"[205]     [206]"
  90. 980 ss=len(ss$):ss$=left$(ss$,ss-6)
  91. 990 fe=fe+1:
  92. 1000 onint((9*rnd(1))+1)goto1150,1010,1010,1150,1030,1010,1140,1010,1160,1030
  93. 1010 b$="you hear scales  rattling-run!":hs=1:printleft$(x$,14)tab(18)"* *"
  94. 1020 goto160
  95. 1030 iffe<20then1010
  96. 1040 y$="":printx$"[145]   [155]you found an exit! e[146]scape or h[146]unt?":fe=5
  97. 1050 gety$:ify$=""then1050
  98. 1060 ify$="h"thenprint"[145]"sb$:goto160
  99. 1070 ify$<>"e"then1040
  100. 1080 print"[147][155]     you found an exit! and escaped":ifgl=0then1200
  101. 1090 print"          with";gl;"gold pots!":goto1200
  102. 1100 ifsw=0thengosub1400
  103. 1110 ifsw=0thenprint"[147][155]     you've been eaten by a dragon":goto1200
  104. 1120 b$="you found a dragon and used the sword":sw=0
  105. 1130 printleft$(x$,14)tab(18)" + +":goto160
  106. 1140 b$="found water, you've more time":wt=0:goto160
  107. 1150 b$="nothing there":goto160
  108. 1160 ifsw=1thenb$="you've found gold!":gl=gl+1:goto160
  109. 1170 b$="you've found a one shot magic sword!":sw=1:goto160
  110. 1180 ifs<1thenprint"[147][155]      sorry - you starved to death!":goto1200
  111. 1190 print"[147][155]       sorry - you died of thirst!":goto1200
  112. 1200 forij=1to100:next:poke59467,0
  113. 1210 print"            try again (y/n)":ag$=""
  114. 1220 getag$:ifag$=""then1220
  115. 1230 ifleft$(ag$,1)="y"thenrun
  116. 1240 ifleft$(ag$,1)<>"n"then1220
  117. 1250 end
  118. 1260 onval(mid$(m$(i,j),4,1))gosub1270,1280,1290,1300,1310:return
  119. 1270 b$="the smoke smell  is strong":return
  120. 1280 b$="soot is on the walls":return
  121. 1290 b$="you can hear dripping water!":return
  122. 1300 b$="blood is on the floor":return
  123. 1310 b$="you hear bats in flight":return
  124. 1320 vb=55:y$="":hs=0:td=0
  125. 1330 gety$:vb=vb-1:ifvb<45then1380
  126. 1340 forij=1to7:next
  127. 1350 ify$="l"andld=1ory$="r"andrd=1ory$="a"andfd=1ory$="b"then1370
  128. 1360 goto1330
  129. 1370 goto210
  130. 1380 ifsw>0then1120
  131. 1390 ifsw<=0then1100
  132. 1400 printleft$(x$,12)tab(19)"[216][192][216]":printtab(18)"(* *)":printtab(18)" [202][209][203]"
  133. 1410 printtab(17)"<<<><>>>":forij=1to1500:next:return
  134. 1420 ss$="":print"[147][156]"tab(14)"[164][164][164][164][164][164][164][164][164][164]
  135. 1430 [129]ij[178]1[164]9:[153][163]13)"waitthen";:[129]ji[178]1[164]10
  136. 1440 mm$[178][201](m$(ij,ji),2):[139]ij[178]i[175]ji[178]j[167][153]"wait^";:[137]1480
  137. 1450 [139]mm$[178]"-2"[167][153]"wait(NULL)";:[137]1480
  138. 1460 [139]mm$[178]"22"[167][153]"m";:[137]1480
  139. 1470 [153]" ";
  140. 1480 [130]ji:[153]"waitfn":[130]ij:[153][163]14)"tab(tab(tab(tab(tab(tab(tab(tab(tab(tab("
  141. 1490 [153]"       press any key to return":[153][163]11)"to the dungeon"
  142. 1500 [161]y$:[139]y$[178]""[167]1500
  143. 1510 [139][201](m$(i,j),2)[178]"-2"[176][201](m$(i,j),2)[178]"22"[167]520
  144. 1520 m$(i,j)[178]m$(i,j)[170]"-2":[137]520
  145. 1530 [139][201](m$(i,j),2)[178]"-2"[167]m$(i,j)[178]m$(i,j)[170]"2":re turn
  146. 1540 [139][201](m$(i,j),2)[178]"22"[167][142]
  147. 1550 m$(i,j)[178]m$(i,j)[170]"22":[142]
  148. 1560 [139][201](m$(i,j),2)[178]"-2"[176][201](m$(i,j),2)[178]"22"[167][142]
  149. 1570 m$(i,j)[178]m$(i,j)[170]"-2":[142]
  150. 1580 [153][200](x$,23);bo$:[153]x$bo$:[142]
  151.